import React, { useEffect, useState } from 'react';
import { fetchHome } from "../core/api";
import useData from "../core/useData";

const Home = ({ staticContext }) => {
  console.log('staticContext ', staticContext)
  const [home, setHome] = useData(staticContext, fetchHome, { title: '', desc: '' })
  const { title, desc } = home

  return (
    <section>
      <h1>Home Page</h1>
      <div>{title}</div>
      <div>{desc}</div>
    </section>
  )
}

// 挂载静态获取数据方法
Home.getData = fetchHome

export default Home